//
// Created by zhangcheng on 2022/8/30.
//

#include <iostream>
#include <eigen3/Eigen/Core>
#include <vector>


#ifndef BSPLINE_POLYFIT_H
#define BSPLINE_POLYFIT_H


class Polyfit {

public:
    Polyfit(int deg, int max_length);
    bool Update(double input);

public:
    std::vector<double> data_list;
    double output;

private:
    Eigen::VectorXd polyfit(Eigen::VectorXd xvals, Eigen::VectorXd yvals);
    double polyeval(Eigen::VectorXd coeffs, double x);

private:
    int order;
    int length;
    std::vector<double> yvalds;
};


#endif //BSPLINE_POLYFIT_H
